package com.hundsun.s3.common.dto;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * 
 *@auther:ChenXi
 *@Date:2018年2月5日 下午5:43:38
 */
public class SR {

		//SR唯一ID
		private String srId;
		
		//服务人员ID
		private String staffId;
		
		//服务人员名字
		private String staffName;
		
		//客户ID
		private String clientId;
		
		//客户名字
		private String clientName;
		
		//评价
		private String evaluate;

		//客户第一次发送信息
		private ArrayList<Message> msg = new ArrayList<>();
		
		//该SR是否有人服务
		private boolean alive = true;
		
//		//客户评价
//		private String evaluate;
		
		//客户提问时间
		private Long generateTime;
		
		//服务人员接单时间
		private Long serviceTime;
		
		//客户评价时间
		private Long endTime;
		
		//接单时间差
		private String timeStep;
		
		//服务时间差
		private String chatStep;
		
		//同步锁（alive）
		Lock lock= new ReentrantLock();

		//判断SR是否被接
		public boolean isAlive() {
			if(alive == false)
				return false;
			if(lock.tryLock()==true) {
					//if(alive==true) {
						alive = false;
						return true;
					//}else
					//	return false;
			}else {
				return false;
			}
		}
		
		public String getStaffName() {
			return staffName;
		}

		public void setStaffName(String staffName) {
			this.staffName = staffName;
		}

		public String getClientName() {
			return clientName;
		}

		public void setClientName(String clientName) {
			this.clientName = clientName;
		}
		
		public String getSrId() {
			return srId;
		}

		public void setSrId(String srId) {
			this.srId = srId;
		}

		public String getClientId() {
			return clientId;
		}

		public void setClientId(String clientId) {
			this.clientId = clientId;
		}

		public String getStaffId() {
			return staffId;
		}

		public void setStaffId(String staffId) {
			this.staffId = staffId;
		}
		
		public String getEvaluate() {
			return evaluate;
		}

		public void setEvaluate(String evaluate) {
			this.evaluate = evaluate;
		}

		public List<Message> getMsg() {
			return msg;
		}

		public void addMsg(Message msg) {
			this.msg.add(msg);
		}

		public Long getGenerateTime() {
			return generateTime;
		}

		public void setGenerateTime(Long generateTime) {
			this.generateTime = generateTime;
		}

		public Long getServiceTime() {
			return serviceTime;
		}

		public void setServiceTime(Long serviceTime) {
			this.serviceTime = serviceTime;
		}

		public Long getEndTime() {
			return endTime;
		}

		public void setEndTime(Long endTime) {
			this.endTime = endTime;
		}

		public String getTimeStep() {
			return timeStep;
		}

		public void setTimeStep(String timeStep) {
			this.timeStep = timeStep;
		}

		public String getChatStep() {
			return chatStep;
		}

		public void setChatStep(String chatStep) {
			this.chatStep = chatStep;
		}

		@Override
		public String toString() {
			return "SR [srId=" + srId + ", staffId=" + staffId + ", staffName="
					+ staffName + ", clientId=" + clientId + ", clientName="
					+ clientName + ", evaluate=" + evaluate + ", msg=" + msg
					+ ", alive=" + alive + ", generateTime=" + generateTime
					+ ", serviceTime=" + serviceTime + ", endTime=" + endTime
					+ ", timeStep=" + timeStep + ", chatStep=" + chatStep
					+ ", lock=" + lock + "]";
		}

			
		
}

